import request from '@/utils/request'
import { getToken } from '@/utils/auth'

var token = getToken();
export function getProjectList (name = '', page, pageSize, draw = 1) {
  return request({
    url: '/pc/management/project/getlist',
    method: 'post',
    data: {
      token: token,
      name: name,
      page: page,
      draw: draw,
      pageSize: pageSize,
    }
  })
}
export function getDetail (id) {
  return request({
    url: 'pc/management/project/detail',
    method: 'post',
    data: {
      token: token,
      id: id,
    }
  })
}
export function adddevicelist() { 
   return request({
    url: "/pc/management/project/adddevicelist",
    data: {
      token: token,
    }, method: 'post',
  })
}

export function setBind(projectId,id) { 
   return request({
    url: "/pc/management/project/adddeviceBond",
    data: {
      token: token,
      projectId: projectId,
      id:id,
    }, method: 'post',
  })
}
export function getDeviceDetail (id) {
  return request({
    url: "/pc/management/project/deviceDetail",
    data: {
      token: token, id: id,
    }, method: 'post',
  })
}
export function unBind (id, deviceId) {
  return request({
    url: "/pc/management/project/untie",
    data: {
      token: token, id: id,
      deviceId: deviceId
    },
    method: 'post',
  })
}
export function getDong (projectId) {
  return request({
    url: "/pc/management/project/getLongdongByProjectId",
    data: {
      token: token, projectId: projectId,
    },
    method: 'post',
  })
}

export function getZhang (projectId, loudong) {
  return request({
    url: "/pc/management/project/getProjectName",
    data: {
      token: token, projectId: projectId,
      Loudong: loudong
    },
    method: 'post',
  })
}
export function getM (projectId) {
  return request({
    url: "/pc/management/project/getReceiptByProjectId",
    data: {
      token: token,
      projectId: projectId,
    },
    method: 'post',
  })
}
export function editDetail (projectId) {
  return request({
    url: "/pc/management/project/editdetail",
    data: {
      token: token,
      id: projectId,
    },
    method: 'post',
  })
}
export function getBank (projectId, loudong) {
  return request({
    url: "/pc/management/project/getProjectNameedit",
    data: {
      token: token,
      projectId: projectId,
      Loudong: loudong
    },
    method: 'post',
  })
}
export function projectIdEdit (projectId) {
  return request({
    url: "/pc/management/project/getReceiptByProjectIdEdit",
    data: {
      token: token,
      projectId: projectId,
    },
    method: 'post',
  })
}
//新增银行账户
export function addAccount (projectId, Loudong, accountName, status) {

  return request({
    url: "/pc/management/project/editProjectName",
    data: {
      token: token,
      projectId: projectId,
      accountName: accountName,
      Loudong: Loudong,
      status: status
    },
    method: 'post',
  })
}
export function upDateM (projectId, name) {
  return request({
    url: "/pc/management/project/updateReceiptByProjectId",
    data: {
      token: token,
      projectId: projectId,
      name: name
    },
    method: 'post',
  })
}
// 获取所有 
export function getAllBank (projectId) {
  return request({
    url: "/pc/management/project/getAllBank",
    data: {
      token: token,
      projectId: projectId
    },
    method: 'post',
  })
}